package com.shuogesha.platform.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import feign.Headers;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;

@FeignClient(value = "cloudFast-tool-upload",configuration = UploadFeignClient.MultipartSupportConfig.class)
public interface UploadFeignClient {
	@RequestMapping(value = "/file/image_upload", method = RequestMethod.POST,consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
 	public Object image_upload(@RequestPart("file") MultipartFile file);
	
	
	/**
	 * 引用配置类MultipartSupportConfig.并且实例化
	 */
	class MultipartSupportConfig {
		@Bean
		public Encoder feignFormEncoder() {
			return new SpringFormEncoder();
		}
	} 

}
